package com.zretc.entity;

import java.util.List;

/**
 * @author: bLUeSuMMerDreamer
 * @createTime: 2020-08-26 14:28
 */
public class Order {
    private String orderId;
    private User user;
    private Double orderPrice;
    private String orderTime;
    private Integer orderStatus;
    private String orderPayMethod;
    private String orderReceiveAddr;
    private String orderReceiveName;
    private String orderReceivePhone;
    private List<OrderDetail> orderDetails;

    public Order(String orderId, User user, String orderTime, Integer orderStatus, String orderPayMethod, String orderReceiveAddr, String orderReceiveName, String orderReceivePhone, List<OrderDetail> orderDetails) {
        this.orderId = orderId;
        this.user = user;
        this.orderPrice = 0.0;
        this.orderTime = orderTime;
        this.orderStatus = orderStatus;
        this.orderPayMethod = orderPayMethod;
        this.orderReceiveAddr = orderReceiveAddr;
        this.orderReceiveName = orderReceiveName;
        this.orderReceivePhone = orderReceivePhone;
        if (orderDetails != null) {
            for (OrderDetail orderDetail : orderDetails) {
                this.orderPrice += orderDetail.getTotalPrice();
            }
        }
        this.orderDetails = orderDetails;
    }

    @Override
    public String toString() {
        return "Order{" +
                "orderId='" + orderId + '\'' +
                ", user=" + user +
                ", orderPrice=" + orderPrice +
                ", orderTime='" + orderTime + '\'' +
                ", orderStatus=" + orderStatus +
                ", orderPayMethod='" + orderPayMethod + '\'' +
                ", orderReceiveAddr='" + orderReceiveAddr + '\'' +
                ", orderReceiveName='" + orderReceiveName + '\'' +
                ", orderReceivePhone='" + orderReceivePhone + '\'' +
                ", orderDetails=" + orderDetails +
                '}';
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Double getOrderPrice() {
        return orderPrice;
    }

    public void setOrderPrice(Double orderPrice) {
        this.orderPrice = orderPrice;
    }

    public String getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(String orderTime) {
        this.orderTime = orderTime;
    }

    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    public String getOrderPayMethod() {
        return orderPayMethod;
    }

    public void setOrderPayMethod(String orderPayMethod) {
        this.orderPayMethod = orderPayMethod;
    }

    public String getOrderReceiveAddr() {
        return orderReceiveAddr;
    }

    public void setOrderReceiveAddr(String orderReceiveAddr) {
        this.orderReceiveAddr = orderReceiveAddr;
    }

    public String getOrderReceiveName() {
        return orderReceiveName;
    }

    public void setOrderReceiveName(String orderReceiveName) {
        this.orderReceiveName = orderReceiveName;
    }

    public String getOrderReceivePhone() {
        return orderReceivePhone;
    }

    public void setOrderReceivePhone(String orderReceivePhone) {
        this.orderReceivePhone = orderReceivePhone;
    }

    public List<OrderDetail> getOrderDetails() {
        return orderDetails;
    }

    public void setOrderDetails(List<OrderDetail> orderDetails) {
        this.orderDetails = orderDetails;
    }


    public Order() {
    }
}
